<template>
  <transition name="el-fade-in-linear">
     <!-- 通过:key绑定$router.fullPath值,当fullPath发生改变,触发组件重新渲染 -->
    <router-view v-if="showRouter" />
  </transition>
</template>

<style>
  .el-table th.gutter{
    display: table-cell!important;
  }
  /* 设置表格内容超出隐藏，鼠标移入显示时的宽度 */
  .el-tooltip__popper{
    width: 500px;
  }
  html{
    overflow: hidden;
  }
  /* 设置分页的背景颜色为none */
  .el-pager li{
    background: none;
  }
  .btn-next,.btn-prev{
    background: none;
  }
</style>
<script>
import Cookies from 'js-cookie'
import { messages } from '@/i18n'
export default {
  provide(){
    return{
      reload:this.reload
    }
  },
  data(){
    return{
      showRouter:true,
    }
  },
  watch: {
    '$i18n.locale': 'i18nHandle'
  },
  created () {
    this.i18nHandle(this.$i18n.locale)
  },

  methods: {
    i18nHandle (val, oldVal) {
      Cookies.set('language', val)
      document.querySelector('html').setAttribute('lang', val)
      document.title = "党建驿站"
      // 非登录页面，切换语言刷新页面
      if (this.$route.name !== 'login' && oldVal) {
        window.location.reload()
      }
    },
    reload(){
      // console.log("刷新")
      this.showRouter = false
      this.$nextTick(()=>{
        this.showRouter = true
      })
    }
  }
}
</script>
<style scoped>
  /* .el-dialog__wrapper{
    overflow: hidden;
  } */
</style>
